//
//  AppDelegate.swift
//  YeKa
//
//  Created by Gina on 15/10/12.
//  Copyright © 2015年 Gina. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        
        window?.backgroundColor = UIColor.whiteColor()
        window?.rootViewController = MainViewController()
        window?.makeKeyAndVisible()
        
        
        
        
        
        
        // 设置全局颜色
        UINavigationBar.appearance().tintColor=UIColor(red: 251.0/255.0, green: 41.0/255.0, blue: 77.0/255.0, alpha: 1.0)
        UITabBar.appearance().tintColor=UIColor(red: 251.0/255.0, green: 41.0/255.0, blue: 77.0/255.0, alpha: 1.0)
        
        // 社交分享
        shejiaoShare()
        
        return true
    }
    
    

    // MARK:    社交分享
    
    private func shejiaoShare(){
        
        // 设置友盟，初始化友盟分享SDK
        UMSocialData.setAppKey("561e672667e58e13ae001bb5")
        
        // 打开新浪微博的SSO开关，设置新浪微博回调地址。这里必须要和你在新浪微博后台设置的回调地址一致。若在新浪后台设置我们的回调地址，“http://sns.whalecloud.com/sina2/callback”,这里可以传nil.
        UMSocialSinaHandler.openSSOWithRedirectURL("http://sns.whalecloud.com/sina2/callback")
        
    }
    
    // 一下两个方法都是用来处理应用间跳转的。
    func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
        
        return UMSocialSnsService.handleOpenURL(url)
        
    }
    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
        
        return UMSocialSnsService.handleOpenURL(url)
        
    }
    
    
   
}

